package com.tec.modules.api;

import com.tec.modules.order.service.dto.BizOrderQueryCriteria;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import me.zhengjie.annotation.Log;
import me.zhengjie.utils.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

@Api(tags = "Api")
@RestController
@RequestMapping("/api/v1")
public class ApiController {

    @Autowired
    private RedisUtils redisUtils;

    @Log("导出数据")
    @ApiOperation("导出数据")
    @GetMapping(value = "/cache/{key}")
    public ResponseEntity<Object> cache(@PathVariable("key") String key) throws IOException {
        List<Object> result = redisUtils.lGet(key, 0, redisUtils.lGetListSize(key));
        return new ResponseEntity(result, HttpStatus.OK);
    }
}
